<template>
	<!--滑动优惠券-->
	<div>
		<div @touchstart="setstoptouch(false)" class="activitiesSlidePic" v-if="dataList && dataList.length>0">
			<banner style="width:100%; height: 100%; position:relative;" :bounce="true">
				<ul>
					<li v-for="(item,index) in dataList" :key="index+'slide'">
						<img v-lazy="item.publicityPicture" :key="item.publicityPicture" @click='jumpEvent(item)' src="static/image/demo1.png" />
					</li>
				</ul>
				<div style="clear: both;"></div>
			</banner>
		</div>
		<div v-if="dataList.length==0 && env === 'edit'" style="height: 2.5rem;line-height: 2.5rem;">请配置数据</div>
	</div>
</template>

<script>
	import { mapMutations } from "vuex";
	import Banner from '../../real-components/BannerScroll';
	import handlePath from "../../utils/lxn/handlePath"
	export default {
		props: {
			dataList: {
				type: Array,
				default: () => []
			},
		},
		data() {
			return {

			}
		},
		components: {
			Banner
		},
		methods: {
			...mapMutations('xxy', [
				"setstoptouch"
			]),
			jumpEvent(item) {
				console.log("打印item",item)
				if(item.extendField) {
					// var urldata = JSON.parse(item.extendField).url.path
					let urldata = handlePath(item)
					if(urldata) {
						this.$router.push({
							path: urldata
							// name: "MiddleWare",
							// params: {
							// 	pageName: urldata
							// }
						})
					}
				}
			},

		},
		computed: {
			env() {
				return window.environment; // 获取是否是编辑状态
			},
		},
		mounted() {

		},
	}
</script>

<style>
	.activitiesSlidePic {
		padding: 0.5rem 0.2rem;
	}
	
	.activitiesSlidePic ul {
		float: left;
		display: flex;
		min-width: 100%;
		position: relative;
	}
	
	.activitiesSlidePic ul li {
		width: 5.9rem;
		height: 2.82rem;
		margin: 0rem 0.1rem;
	}
	
	.activitiesSlidePic ul li img {
		width: 100%;
		height: 100%;
	}
</style>